Server Watch Plugin SDK | Date: 6 Feb 2004 Release: 1.0 |
#include <ISWServerSettings.h>
Server Watch will generate an instance of this class automatically. You will not need to store instances of this class as the appropriate instance will be passed into the plugin as a member of an SWPluginServerStruct when the plugin is expected to handle a server specific event.
Public Types | |
enum | JOIN_PARAM_TYPE { ANY_TEXT, PASSWORD, BOOLEAN } |
Public Member Functions | |
Concurrency | |
Functions that manage the reader/writer thread safety process
This class is used in a highly threaded environment. These functions provide an interface that, when used correctly, will protect the integrity of this class and the stability of Server Watch.
// Standard usage pMySWServerSettings->BeginRead(); ... Call "get" functions pMySWServerSettings->EndRead(); // Deadlock Scenario pMySWServerSettings->BeginRead(); pMySWServerSettings->BeginWrite(); // Deadlocks pMySWServerSettings->EndRead(); // You will never get here pMySWServerSettings->EndWrite(); // If each is on its own thread, the above is safe. One thread will // wait for the other // Thread 1 pMySWServerSettings->BeginRead(); pMySWServerSettings->EndRead(); // Thread 2 pMySWServerSettings->BeginWrite(); pMySWServerSettings->EndWrite(); // Demonstrates how more than one can read at a time pMySWServerSettings->BeginRead(); pMySWServerSettings->BeginRead(); // No Deadlock pMySWServerSettings->EndRead(); pMySWServerSettings->EndRead();
Write Mode:
// Standard usage pMySWServerSettings->BeginWrite(); ... Call "set" functions pMySWServerSettings->EndWrite(); // Deadlock Scenario pMySWServerSettings->BeginRead(); pMySWServerSettings->BeginWrite(); // Deadlocks pMySWServerSettings->EndRead(); // You will never get here pMySWServerSettings->EndWrite(); // If each is on its own thread, the above is safe. One thread will // wait for the other // Thread 1 pMySWServerSettings->BeginRead(); pMySWServerSettings->EndRead(); // Thread 2 pMySWServerSettings->BeginWrite(); pMySWServerSettings->EndWrite(); // Demonstrates how only one write can exist at a time pMySWServerSettings->BeginWrite(); pMySWServerSettings->BeginWrite(); // Deadlocks pMySWServerSettings->EndWrite(); // You will never get here pMySWServerSettings->EndWrite(); // If each is on its own thread, the above is safe. One thread will // wait for the other // Thread 1 pMySWServerSettings->BeginWrite(); pMySWServerSettings->EndWrite(); // Thread 2 pMySWServerSettings->BeginWrite(); pMySWServerSettings->EndWrite();
| |
virtual void | BeginRead ()=0 |
Puts the class in read mode. | |
virtual void | EndRead ()=0 |
Removes the class from read mode. | |
virtual void | BeginWrite ()=0 |
Puts the class in write mode. | |
virtual void | EndWrite ()=0 |
Removes the class from write mode. | |
virtual void | Retain ()=0 |
Retains the class for use. | |
virtual void | Release ()=0 |
Removes your retain rights for the class. | |
Monitor Mode | |
virtual bool | ServerIsMonitoring ()=0 |
Indicates whether the server is in monitor mode or not. | |
Server Information | |
Basic information required to access a server | |
virtual int | GetPort () const =0 |
Retrieves the server's port. | |
virtual std::wstring | GetServerAddress () const =0 |
Retrieves the server's address. | |
virtual std::wstring | GetUserSetServerName () const =0 |
Retrieves the name the user has given the server. | |
virtual std::wstring | GetServerType () const =0 |
Retrieves the server type. | |
virtual SWHandle | GetServerHandle () const =0 |
Retrieves the server's handle. | |
virtual SWHandle | GetPluginHandle () const =0 |
Retrieves the handle to the server's plugin. | |
Timings Data | |
Basic network timing settings | |
virtual int | GetTimeout () const =0 |
Retrieves the timeout set for a ping. | |
Join Functionality | |
These functions allow plugins to create and manage plugin specific join parameters. By default, if a plugin supports join the "Application" and "Free Form" parameters will automatically be created. Often, plugins need more than these two. | |
virtual SWRESULT | CreateJoinParam (const int id, const std::wstring &name, const std::wstring &help, const bool required=false, JOIN_PARAM_TYPE type=ISWServerSettings::ANY_TEXT)=0 |
Creates a new parameter for the user to enter data into for a join. | |
virtual SWRESULT | CreateJoinParam (const int id, const std::wstring &name, const std::wstring &help, const std::wstring &initialValue, const bool required=false, JOIN_PARAM_TYPE type=ISWServerSettings::ANY_TEXT)=0 |
Creates a new parameter for the user to enter data into for a join. | |
virtual SWRESULT | GetJoinParamValue (const int id, std::wstring &value) const =0 |
Retrieves the value for a given join param identifier. | |
virtual SWRESULT | SetJoinParamValue (const int id, const std::wstring &value)=0 |
Sets the value for a given join param identifier. | |
virtual SWRESULT | GetJoinParamHelpText (const int id, std::wstring &help) const =0 |
Retrieves the help text for a given join param identifier. | |
virtual SWRESULT | SetJoinParamHelpText (const int id, const std::wstring &help)=0 |
Sets the help text for a given join param identifier. | |
virtual std::wstring | GetJoinApp () const =0 |
The full path to the application that will be used to connect to the server. | |
virtual SWRESULT | SetJoinApp (const std::wstring &theApp)=0 |
Sets the full path to the application that will be used to connect to the server. | |
virtual std::wstring | GetJoinParamsFreeForm () const =0 |
Retrieves the parameters that were entered in the free form entry box. | |
virtual SWRESULT | SetJoinParamsFreeForm (const std::wstring &theManualParams)=0 |
Sets the parameters that are to be entered in the free form entry box. |
|
|
Puts the class in read mode. Function blocks until any existing writers are finished writing. |
|
Removes the class from read mode.
|
|
Puts the class in write mode.
Function blocks until all existing readers or writers have completed. |
|
Removes the class from write mode.
|
|
Retains the class for use.
Call Retain() on the class when you spawn a thread. This will allow you to use the class without fear of it being deleted while you are using it. |
|
Removes your retain rights for the class. Only call Release() if you have called Retain(). Calling Release() too many times will result in a crash in Server Watch. So, make sure your Release() and Retain() match up one-for-one. |
|
Indicates whether the server is in monitor mode or not. If a server is in monitor mode, it is updateing on a regular interval. Most alerts (email, audio, etc) are only triggered when the server is in monitor mode. Therefore, you may want to consider only trigering your plugin server specific alerts when the server is in monitor mode.
|
|
Retrieves the server's port.
|
|
Retrieves the server's address.
|
|
Retrieves the name the user has given the server.
|
|
Retrieves the server type.
|
|
Retrieves the server's handle.
|
|
Retrieves the handle to the server's plugin.
|
|
Retrieves the timeout set for a ping. The timeout is in seconds.
|
|
Creates a new parameter for the user to enter data into for a join.
#define PLAYER_NAME_PARAM 1 #define PASSWORD_PARAM 2 #define CHOICE_PARAM 3 // pSetings is a pointer to an instance of ISWServerSettings pSetings->BeginWrite(); // Creates a regular edit field based param with a title "Name" and help // text of "Set the player name." The value is optional. pSetings->CreateJoinParam( PLAYER_NAME_PARAM, L"Name", L"Set the player name." ); // Creates a password edit field based (displays asterisks instead of the values // entered) param with a title "Password" and help text of "Set the password." // The field is required pSetings->CreateJoinParam( PLAYER_NAME_PARAM, L"Password", L"Set the password.", true, ISWServerSettings::PASSWORD ); // Creates a boolean selection based (displays a yes/no combobox) param with a title // "Bool" and help text of "Pick Yes or No." The field is optional (though will // always contain a value since it is of a boolean type). pSetings->CreateJoinParam( PLAYER_NAME_PARAM, L"Password", L"Pick Yes or No.", false, ISWServerSettings::BOOLEAN ); pSetings->EndWrite();
|
|
Creates a new parameter for the user to enter data into for a join.
|
|
Retrieves the value for a given join param identifier.
|
|
Sets the value for a given join param identifier.
|
|
Retrieves the help text for a given join param identifier.
|
|
Sets the help text for a given join param identifier.
|
|
The full path to the application that will be used to connect to the server. The join app parameter is automatically created for any plugin that supports join.
|
|
Sets the full path to the application that will be used to connect to the server.
|
|
Retrieves the parameters that were entered in the free form entry box. The free form parameter is automatically created for any plugin that supports join. This parameter allows the users to add any parameters they want to in a free format.
|
|
Sets the parameters that are to be entered in the free form entry box. The free form parameter is automatically created for any plugin that supports join. The parameter value can be any free form string.
|
Copyright (c) 2003-2004, Deep Fried Software. All rights reserved. |